package com.wpp.controller;

import com.github.pagehelper.PageInfo;
import com.wpp.pojo.ArticlePO;
import com.wpp.service.ArticleService;
import com.wpp.util.PageUtil;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;

/**
 * @author by wpp25
 * @Classname ArticleController
 * @Description
 * @Date 2020/11/7 10:51
 */
@Controller
@RequestMapping("/article/api")
public class ArticleController {

    @Resource
    private ArticleService articleService;


    @RequestMapping("/list")
    public String list(@RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize, Model model) {

        PageUtil<ArticlePO> articlePOPageInfo = articleService.listByPage(pageNum, pageSize);

        model.addAttribute("list",articlePOPageInfo.getPageData());

        model.addAttribute("page",articlePOPageInfo);
        return "client/index";
    }

}
